package pl.perseus.dao;
 
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import pl.perseus.model.User;
import pl.perseus.model.UserClasses;

@Repository
public class UserClassesDao extends BaseDao<UserClasses> implements IUserClassesDao{
 
	
	public UserClassesDao() {
		super("UserClasses");
	}

	@Override
    public UserClasses selectByIdUserClasses(Long id) {
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("id", id);
        return queryForObject("getByIdUserClasses", map);
    }
	
	@Override
	public UserClasses insertUserClasses(UserClasses UserClasses){
		return insertBean("insertUserClasses", UserClasses);
	}
	
	@Override
	public UserClasses deleteUserClasses(UserClasses UserClasses){
		return insertBean("deleteUserClasses", UserClasses);
	}
 
	@Override
	public void deleteByUser(User u){
		UserClasses uc = new UserClasses();
		uc.setId_user(u.getId());
		delete("deleteByUser", uc);
	}
	
}
